feat: meos-idl.json-driven OO method-family codegen (Draft preview)#89
Open
estebanzimanyi wants to merge 1 commit into
Open
feat: meos-idl.json-driven OO method-family codegen (Draft preview)#89estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
98f5065 to
a5a558f
Compare
Reads a vendored meos-idl.json and emits one PyMEOS OO method per regular method-family member (comparison, spatial relationship, distance, restriction) into tools/oo_codegen/_preview/<family>_methods.py. Each generated method dispatches, by the argument's C-name token, to the exact pymeos_cffi backing function the hand-written surface uses, so it is identical to its hand-written counterpart by construction; nothing is reimplemented. The irregular core (constructors, conversions, accessors, transforms, I/O) stays hand-written and is counted, not dropped. tools/oo_codegen/_preview/ is a non-destructive Draft artifact the package never imports; it lets a reviewer diff the generated uniform surface against pymeos/main/*.py before any staged migration. Delivery mirrors GoMEOS PR #2; the dispatch/backing model mirrors PyMEOS PR #87. Coverage: 2833 catalogued functions fully accounted for - 107 regular methods (407 typed overloads) across all six families (cbuffer, geo, npoint, pose, rgeo, temporal), 864 hand-written core, 43 Datum-bearing internals excluded, 1519 out of scope. Zero unaccounted. Adds tests/test_oo_codegen_coverage.py (offline gate: zero unaccounted, six families, preview compiles and stays in lock-step with the generator, every backing symbol is a real catalogued function) and a CI step running the generator's accounting check.
1e7d6ea to
85deb9b
Compare
This was referenced May 19, 2026
estebanzimanyi
added a commit
that referenced
this pull request
May 19, 2026
Implements the PyMEOS-side follow-up of RFC #94 §5: a consumer that emits faithful geo/temporal mixins from the canonical oo.<family>.<member>.dispatch blocks the parallel MEOS-API session is adding to meta/meos-meta.json (merged into meos-idl.json). Additive only -- the 4 shipped families' FAMILY_MODEL path (emit_faithful_mixin) is untouched; #90/#91/#92/#93 mixins regenerate byte-identical (regression-guarded) and #89 coverage gate stays green. Proven correct WITHOUT waiting on the not-yet-published metadata: _serialize_family_dispatch() expresses each of the 4 A/B-proven families (cbuffer/pose/npoint/rgeo) in the RFC #94 §3 schema; feeding those back through emit_from_oo_dispatch() reproduces their committed mixins BYTE-IDENTICALLY for all 4 (the new --verify-oo-roundtrip gate + OoDispatchConsumer test, permanently enforced). geo/temporal then plug into this same proven consumer the instant MEOS-API emits their oo.dispatch (via --mixin-from-dispatch), closing codegen 6/6 -- no PyMEOS-local transcription, equivalence by construction at the catalog level. This is the non-wasted parallel prep: when the keystone enrichment lands, PyMEOS converges immediately. Stacked on #94 (the RFC).
estebanzimanyi
added a commit
that referenced
this pull request
May 19, 2026
Implements the PyMEOS-side follow-up of RFC #94 §5: a consumer that emits faithful geo/temporal mixins from the canonical oo.<family>.<member>.dispatch blocks the parallel MEOS-API session is adding to meta/meos-meta.json (merged into meos-idl.json). Additive only -- the 4 shipped families' FAMILY_MODEL path (emit_faithful_mixin) is untouched; #90/#91/#92/#93 mixins regenerate byte-identical (regression-guarded) and #89 coverage gate stays green. Proven correct WITHOUT waiting on the not-yet-published metadata: _serialize_family_dispatch() expresses each of the 4 A/B-proven families (cbuffer/pose/npoint/rgeo) in the RFC #94 §3 schema; feeding those back through emit_from_oo_dispatch() reproduces their committed mixins BYTE-IDENTICALLY for all 4 (the new --verify-oo-roundtrip gate + OoDispatchConsumer test, permanently enforced). geo/temporal then plug into this same proven consumer the instant MEOS-API emits their oo.dispatch (via --mixin-from-dispatch), closing codegen 6/6 -- no PyMEOS-local transcription, equivalence by construction at the catalog level. This is the non-wasted parallel prep: when the keystone enrichment lands, PyMEOS converges immediately. Stacked on #94 (the RFC).
estebanzimanyi
added a commit
that referenced
this pull request
May 19, 2026
Implements the PyMEOS side of RFC #94 §5/§7: a consumer that emits faithful geo/temporal mixins from the canonical objectModel.dispatch metadata (MEOS-API #10 feat/object-model, merged into meos-idl.json), closing the OO codegen to all 6 temporal type families with equivalence by construction at the catalog level. Additive only — the 4 derivable families' FAMILY_MODEL path (emit_faithful_mixin) is untouched; #90/#91/#92/#93 mixins regenerate byte-identical (--verify-oo-roundtrip + OoDispatchConsumer .test_roundtrip_byte_identical, permanently enforced) and the #89 coverage gate stays green. geo + the 4 temporal concretes (TFloat/TInt/TBool/TText) are not derivable from the signature catalog (RFC #94 §1), so they are driven by the verbatim objectModel.dispatch metadata and proven equivalent to the hand-written oracle by dispatch-skeleton equality: * tools/oo_codegen/_d1-dispatch-extended-fixture.json — the verbatim §7 dispatch metadata (== MEOS-API #10 objectModel.dispatch). * tools/oo_codegen/_oracle_extended_methods.py — the byte-for-byte hand-written editorial methods (AST-extracted) the proof checks against; never executed, never imported. * --verify-oo-dispatch-extended + OoDispatchConsumer .test_extended_dispatch_matches_oracle: each of the 32 editorial methods (geo at/minus/distance/nearest_approach_distance + each concrete's always/ever/temporal eq·ne, at, minus) reduces to an identical ordered dispatch skeleton — isinstance type-set, backing symbol, arg transform, super-coerce, fallback, result wrap. 0 divergence: same native calls, same transforms, never reimplemented. The closed argTransform vocabulary maps to PyMEOS idioms (scalarValue, scalarCast-per-base, geoToGserialized with geodeticFromSelf, stboxToGeo, innerPtr, textsetMake, list[str], coerce + via:super). Stacked on #94 (the RFC, including the verbatim §7 SoT).
estebanzimanyi
added a commit
that referenced
this pull request
May 19, 2026
Implements the PyMEOS side of RFC #94 §5/§7: a consumer that emits faithful geo/temporal mixins from the canonical objectModel.dispatch metadata (MEOS-API #10 feat/object-model, merged into meos-idl.json), closing the OO codegen to all 6 temporal type families with equivalence by construction at the catalog level. Additive only — the 4 derivable families' FAMILY_MODEL path (emit_faithful_mixin) is untouched; #90/#91/#92/#93 mixins regenerate byte-identical (--verify-oo-roundtrip + OoDispatchConsumer .test_roundtrip_byte_identical, permanently enforced) and the #89 coverage gate stays green. geo + the 4 temporal concretes (TFloat/TInt/TBool/TText) are not derivable from the signature catalog (RFC #94 §1), so they are driven by the verbatim objectModel.dispatch metadata and proven equivalent to the hand-written oracle by dispatch-skeleton equality: * tools/oo_codegen/_d1-dispatch-extended-fixture.json — the verbatim §7 dispatch metadata (== MEOS-API #10 objectModel.dispatch). * tools/oo_codegen/_oracle_extended_methods.py — the byte-for-byte hand-written editorial methods (AST-extracted) the proof checks against; never executed, never imported. * --verify-oo-dispatch-extended + OoDispatchConsumer .test_extended_dispatch_matches_oracle: each of the 32 editorial methods (geo at/minus/distance/nearest_approach_distance + each concrete's always/ever/temporal eq·ne, at, minus) reduces to an identical ordered dispatch skeleton — isinstance type-set, backing symbol, arg transform, super-coerce, fallback, result wrap. 0 divergence: same native calls, same transforms, never reimplemented. The closed argTransform vocabulary maps to PyMEOS idioms (scalarValue, scalarCast-per-base, geoToGserialized with geodeticFromSelf, stboxToGeo, innerPtr, textsetMake, list[str], coerce + via:super). Stacked on #94 (the RFC, including the verbatim §7 SoT).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
meos-idl.json-driven generator for PyMEOS's regular OO methodfamilies, delivered as a non-destructive Draft artifact.
What it does
tools/oo_codegen/codegen.pyreads the vendoredmeos-idl.json(thesignature catalog every binding consumes) and emits one PyMEOS OO method
per regular method-family member — comparison, spatial relationship
(ever/always/temporal), distance, restriction — into
tools/oo_codegen/_preview/<family>_methods.py.Each generated method dispatches, by the argument's C-name token, to the
exact
pymeos_cffibacking function the hand-written surface uses, soit is identical to its hand-written counterpart by construction — nothing
is reimplemented. The irregular core (constructors, conversions,
accessors, transforms, I/O) is not synthesisable from signatures and
stays hand-written; it is counted and named, never silently dropped.
tools/oo_codegen/_preview/is never imported by thepymeospackage (underscore-prefixed, lazily-resolved cffi shim). It exists so a
reviewer can diff the generated uniform, deterministic surface against
pymeos/main/*.pybefore any staged migration. Delivery mirrors GoMEOSPR #2 (
refactor/codegen-meos-idl); the dispatch/backing model mirrorsPyMEOS PR #87 (
tools/portable_aliases/).Coverage
2833 catalogued functions, fully accounted for:
Zero unaccounted. cbuffer/npoint/pose/rgeo are full first-class families,
never a headline exclusion.
Gates
tests/test_oo_codegen_coverage.py(offline): zero unaccounted, all sixfamilies, preview compiles, committed preview stays in lock-step with
the generator, every backing symbol is a real catalogued function.
codegen.py --check.Base
Stacked on #88 (
feat/extended-temporal-types) so the preview covers theextended cbuffer/npoint/pose/rgeo types.
Follow-up
A staged migration that retires the hand-written regular families in
favour of the generated ones (rename
_preview/and wire the mixins intothe type hierarchy) once the preview has been reviewed.